<!DOCTYPE html>
<html lang="cn">
<head>
    <meta charset="UTF-8">
    <title>计算器plus</title>
    <script type="text/javascript">
        let calculate = function (i) {
            let number_1 = document.getElementById("number_1").value;
            let number_2 = document.getElementById("number_2").value;
            if (isNaN(number_1) || isNaN(number_2)) {
                alert("请输入正确的数字");
                return;
            }
            document.getElementById("result").value = eval(number_1 + i + number_2);
        };
    </script>
</head>
<body>
<label for="number_1">第一个数字：</label><input type="text" id="number_1">
<br>
<label for="number_2">第二个数字：</label><input type="text" id="number_2">
<br>
<button onclick="calculate('+')">+</button>
<button onclick="calculate('-')">-</button>
<button onclick="calculate('*')">*</button>
<button onclick="calculate('/')">/</button>
<br>
<label for="result">计算结果：</label><input type="text" id="result">
<br>

</body>
</html>